<!--
 * @Descripttion: 
 * @Author: 夜雨
 * @Email: 448408740@qq.com
 * @Date: 2019-11-28 15:20:33
 * @LastEditTime: 2019-12-04 14:09:25
 -->
<!DOCTYPE html>
<html style="height: 100%">

<head>
    <meta charset="utf-8">
</head>

<body style="height: 100%; margin: 0">
    <div id="container" style="height: 100%"></div>
    <script src="__JS__/echarts.min.js" charset="utf-8"></script>
    <script type="text/javascript">
        var str = '{$data}';
        str = str.replace(/&quot;/g, '"');
        var obj = JSON.parse(str);
        var obj_date = Object.keys(obj);
        var obj_count = Object.values(obj);

        var dom = document.getElementById("container");
        var myChart = echarts.init(dom);
        var app = {};
        option = null;
        option = {
            title: {
                text: '{$kw}',
                left: 'center'
            },
            tooltip: {
                trigger: 'axis',
                axisPointer: {
                    type: 'cross',
                    label: {
                        backgroundColor: '#6a7985'
                    }
                }
            },
            toolbox: {
                feature: {
                    saveAsImage: {}
                }
            },
            grid: {
                left: '5%',
                right: '5%',
                bottom: '5%',
                containLabel: true
            },
            xAxis: [
                {
                    type: 'category',
                    boundaryGap: false,
                    data: obj_date
                }
            ],
            yAxis: [
                {
                    type: 'value'
                }
            ],
            series: [
                {
                    name: '{$kw}',
                    type: 'line',
                    stack: '搜索次数',
                    areaStyle: {},
                    data: obj_count
                }
            ]
        };
        ;
        if (option && typeof option === "object") {
            myChart.setOption(option, true);
        }
    </script>
</body>

</html>